<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>一元夺宝</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<include file="public/comm" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav fs_xl">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">夺宝详情</h1>
		</header>
		<div class="mui-content fs_xl">
			<div class="one_info">
				<div class="swiper-container">
					<div class="swiper-wrapper">
						<foreach name="goods_images_list" item="vo" key="k">
						<div class="swiper-slide"><img src="{$vo.image_url}" /></div>
						</foreach>
					</div>
					<div class="pagination"></div>
				</div>
			</div>
			<div class="one_title fs_xl cls">
				<div class="one_tit_lt">
					<span class="one_sp1 fs_xxs">¥<em class="fs_xi">{$indiana.price}</em>.00</span>
					<span class="one_sp2 fs_xs">¥{$goods.market_price}</span>
					<span class="one_sp3 fs_xs">还差{$indiana.stock_num}人次即开奖</span>
				</div>
				<div class="one_tit_rt">
					<p class="fs_xs">距夺宝结束</p>
					<p class="time_djs fs_xs" data-time="{$indiana.end_time|date='Y/m/d H:i:s',###}"><span class="db_d">00</span>:<span class="db_h">00</span>:<span class="db_m">00</span>:<span class="db_s">00</span></p>
				</div>
			</div>
			<div class="one_sp_tit fs_l" style="height: initial;">
				<p style="border-bottom: 0;padding: 0.8em 0.5em;"><span class="db_qs_1">【第{$indiana.id}期】</span><span class="db_tit_1">{$indiana.title}</span></p>
				<p id="ks_time" style="display: none;">{$indiana.start_time}</p>
				<p id="js_time" style="display: none;">{$indiana.end_time}</p>
			</div>
			<div class="one_m_info">
				<div class="one_top cls">
					<ul class="cls">
						<li class="active">图文详情</li>
						<li>商品参数</li>
						<li>参与实况</li>
					</ul>	
				</div>
				<div class="one_info_m">
					<div class="one_item active">
						{$goods.goods_content|htmlspecialchars_decode}
					</div>
					<div class="one_item canshu">
						<foreach name="goods_attr_list" item="vo" key="k">
							<p>{$goods_attribute[$vo.attr_id]}:<span>{$vo.attr_value}</span></p>
						</foreach>
						<!--<p>品牌<span>古川</span></p>
						<p>香型<span>浓香型</span></p>
						<p>主题<span>金婚红</span></p>
						<p>窖藏方式<span>室内窖藏</span></p>
						<p>产地<span>古川</span></p>
						<p>厂名<span>古川</span></p>
						<p>厂址<span>古川</span></p>
						<p>生产许可证号<span>川-B1544580012</span></p>-->
					</div>
					<div class="one_item cyjl">
						<div class="cyjl_top">
							<p class="fs_s">第{$indiana.id}期参与记录</p>
							<p class="fs_s">{$indiana.start_time|date="Y-m-d H:i:s",###}</p>
						</div>
						<div class="cy_list">
							<ul>
								<foreach name='indiana_order' item='vo' key='k'>
									<li class="cls">
										<div class="cy_img">
											<img src="{$vo.user.head_pic}" />
										</div>
										<div class="cy_info">
											<p class="fs_s">{$vo.user.nickname}<em class="cy_ph">{$vo.user.mobile|substr_replace=###,'****',3,4}</em></p>
											<p class="fs_s">夺宝<i>{$vo.num}</i>次<em>{$vo.pay_time|date="H:i:s",###}</em></p>
										</div>
									</li>
								</foreach>
							</ul>
						</div>
					</div>
				</div>				
			</div>
			<div class="nav fs_xl">
				<a class="kf" target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=294398694&site=qq&menu=yes">
					<p class="mui-icon iconfont icon-kefu fs_i"></p>
					<p class="fs_s">客服</p>
				</a>
				<a class="dp" href="{:U('Mobile/Cellar/factoryInfo',array('id'=>$goods.suppliers_id))}">
					<p class="mui-icon iconfont icon-dianpu fs_i"></p>
					<p class="fs_s">店铺</p>
				</a>
				<a href="javascript:;" class="btn fs_m">立即夺宝</a>
			</div>
		</div>
		<script type="text/javascript">
		    
		    
			$(".device,.swiper-container").height($(".swiper-slide img").height());
			$(".swiper-container1").height($(".swiper-slide").height());
			$(window).resize(function() {
				$(".device,.swiper-container").height($(".swiper-slide img").height());
				$(".swiper-container1").height($(".swiper-slide").height());
			});
			var onel1=$(".one_sp1").width()+5;
			$(".one_sp2,.one_sp3").css("left",onel1);
		</script>
		<script>
			$(function(){
				var is_val = <if empty($is_val)>0<else>1</if>;
				if(is_val != 1){
					alert('亲，请先登录，绑定您的手机号才能参与夺宝活动哦！');
				}else{
					//location.href="{:U('Mobile/User/red_packet')}";
				}
			
			})
			var mySwiper = new Swiper('.swiper-container', {
				pagination: '.pagination',
				loop: true,
				autoplay : 5000,
				grabCursor: true,
				autoplayDisableOnInteraction : false,
				paginationClickable: true
			});
			var t1=$(".time_djs").attr("data-time");
			function sdsd(){
      			show_time(t1,".db_d",".db_h",".db_m",".db_s");
      		}
			$(function(){
				$(".one_top li").click(function () {
        			$(".one_top li").removeClass("active").eq($(".one_top li").index(this)).addClass("active");
        			$(".one_item").hide().eq($('.one_top li').index(this)).show();
    			});
				
				setInterval("sdsd()",1000);
//    			show_time(t1,".db_d",".db_h",".db_m",".db_s");
      			$(".nav .btn").click(function(){
      				var stock_num = {$indiana.stock_num};
      				if(stock_num == 0){
      					layer.alert('该宝贝抽奖码已售空！',2);
      					return false;
      				}
      				var imgR=$(".swiper-wrapper .swiper-slide:first-child img").attr("src");
      				window.location.href="{:U('Mobile/Goods/indianaOrder',array('id'=>$indiana.id))}";
      			});
      			var ks_time=$("#ks_time").text()*1000;
      			var js_time=$("#js_time").text()*1000;
      			var time_dq=new Date().getTime();
      			console.log(ks_time);
      			console.log(js_time);
      			console.log(time_dq);
      			if(time_dq>=ks_time){
      				$(".btn").css("pointer-events","auto");
      				$(".btn").css("background","#f5ba26");
      				if(time_dq>=js_time){
      					$(".btn").css("pointer-events","none");
      					$(".btn").css("background","#666");
      				}
      			}
			})
			function show_time(T1,id1,id2,id3,id4) {
				var time_start = new Date().getTime(); //设定当前时间
				var time_end = new Date(T1).getTime(); //设定目标时间
				// 计算时间差 
				var time_distance = time_end - time_start;// 天
				if(time_distance>0){
					var int_day = Math.floor(time_distance / 86400000)
					time_distance -= int_day * 86400000;// 时
					var int_hour = Math.floor(time_distance / 3600000)
					time_distance -= int_hour * 3600000;// 分
					var int_minute = Math.floor(time_distance / 60000)
					time_distance -= int_minute * 60000;// 秒 
					var int_second = Math.floor(time_distance / 1000)
					if(int_day < 10) {
						int_day = "0" + int_day;
					}// 时分秒为单数时、前面加零
					if(int_hour < 10) {
						int_hour = "0" + int_hour;
					}
					if(int_minute < 10) {
						int_minute = "0" + int_minute;
					}
					if(int_second < 10) {
						int_second = "0" + int_second;
					}
					$(id1).html(int_day);
					$(id2).html(int_hour);
					$(id3).html(int_minute);
					$(id4).html(int_second);// 显示时间 				
//					setTimeout("show_time()", 1000);// 设置定时器
				}else{
					$(".btn").css("pointer-events","none");
					$(".btn").css("background","#666");
				}
				
			}
		</script>
	</body>

</html>